using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace Microsoft.ConnectionEngine.Registers.Core.ServiceProvider.DataAccess
{
    public class DataAccessHelper
    {
        public static SqlConnection GetConnection()
        {
            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[1].ConnectionString;
            SqlConnection connection = new SqlConnection(connectionString);
            connection.Open();
            return connection;
        }

        public static string GetDefaultConnectionStringName()
        {
            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings[1].Name;
            return connectionString;
        }

        public static void CloseConnection(SqlConnection connection)
        {
            if (connection != null && connection.State != System.Data.ConnectionState.Closed)
                connection.Close();
        }
    }


}
